package org.huntaway.kernel;

/**
 * @author yangzengying
 * 
 */
public class NutException extends RuntimeException {
	private Exception currExce = null;
	private static final long serialVersionUID = 1L;

	/**
	 * @param exception
	 */
	public NutException(Exception exception) {
		currExce = exception;
	}
	/**
	 * @param excepMes
	 */
	public NutException(String excepMes) {
		currExce = new Exception(excepMes);
	}
	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Throwable#printStackTrace()
	 */
	public void printStackTrace() {
		currExce.printStackTrace();
	}

	/* (non-Javadoc)
	 * @see java.lang.Throwable#getMessage()
	 */
	public String getMessage() {
		return currExce.getMessage();
	}

	/**
	 * @return
	 */
	public Exception getCurrExce() {
		return currExce;
	}

	/**
	 * @param currExce
	 */
	public void setCurrExce(Exception currExce) {
		this.currExce = currExce;
	}
	/**
	 * 
	 */
	public void exception() {
		System.out.println(currExce);
		StackTraceElement[] trace = currExce.getStackTrace();
		for (int i = 0; i < trace.length; i++) {
			System.out.println("\tat " + trace[i]);
		}
	}
	
}
